package wang.Map1;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapTraverse {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("wang", "www");
        map.put("chen", "ccc");
        map.put("zhang", "zzz");
        map.put("zhao", "ooo");
//        Set<Map.Entry<String, String>> entry = map.entrySet();
//        entry.forEach(stringStringEntry -> {
//            System.out.println(stringStringEntry);
//        });
        Set<Map.Entry<String, String>> entries = map.entrySet();
//        for (Map.Entry<String, String> stringStringEntry : entries) {
//            System.out.println(stringStringEntry.getKey());
//            System.out.println(stringStringEntry.getValue());
//            System.out.println(stringStringEntry);
//        }

//
//        Iterator<Map.Entry<String,String>> it=entries.iterator();
//        while (it.hasNext()){
//
//            System.out.println(it.next());
//        }

      entries.forEach(stringStringEntry -> {
          System.out.println(stringStringEntry.getKey());
          System.out.println(stringStringEntry.getValue());
          System.out.println(stringStringEntry);
      });

      map.forEach(((s, s2) -> System.out.println(s+"="+s2)));
      //  System.out.println(map.entrySet());
    }
}
